import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class StorageSpecialRegionItemView extends StatefulWidget {
  int type;

  StorageSpecialRegionItemView({this.type = 0});

  @override
  State<StatefulWidget> createState() => _StorageSpecialRegionItemViewState();
}

class _StorageSpecialRegionItemViewState
    extends State<StorageSpecialRegionItemView> {
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(12.w),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(4.w),
      ),
      child: Column(
        children: [
          Row(
            children: [
              Text(
                '拓维信息',
                style: TextStyle(
                    color: Color(0xFF333333),
                    fontSize: 16.sp,
                    fontWeight: FontWeight.bold),
              ),
              Spacer(),
              Text(
                '¥22,000.00',
                style: TextStyle(
                    color: Color(0xFF333333),
                    fontSize: 16.sp,
                    fontWeight: FontWeight.w500),
              ),
            ],
          ),
          Container(
            height: 1.w,
            color: Color(0xFFF5F4F3),
            margin: EdgeInsets.only(top: 10.w, bottom: 10.w),
          ),
          Stack(
            children: [
              Column(
                children: [
                  Row(
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Image.asset(
                        'assets/images/ic_business_type.png',
                        width: 16.w,
                        height: 16.w,
                      ),
                      Text(
                        '消费贷',
                        style: TextStyle(
                            color: Color(0xFF999999), fontSize: 12.sp),
                      )
                    ],
                  ),
                  SizedBox(
                    height: 5.w,
                  ),
                  Row(
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Image.asset(
                        'assets/images/ic_time.png',
                        width: 16.w,
                        height: 16.w,
                      ),
                      Text(
                        '2021-01-12 12:12',
                        style: TextStyle(
                            color: Color(0xFF999999), fontSize: 12.sp),
                      )
                    ],
                  ),
                ],
              ),
              Positioned(
                bottom: 0,
                right: 0,
                child: InkWell(
                    onTap: () {},
                    child: Container(
                      width: 100.w,
                      height: 24.w,
                      alignment: Alignment.center,
                      decoration: BoxDecoration(
                          color: Colors.white,
                          borderRadius: BorderRadius.circular(12.w),
                          border:
                              Border.all(color: Color(0xFF009669), width: 1.w)),
                      child: Text(
                        '联系客户',
                        textAlign: TextAlign.center,
                        style: TextStyle(
                            fontSize: 13.sp, color: Color(0xFF009669)),
                      ),
                    )),
              ),
              Positioned(
                right: 0,
                bottom: 18.w,
                child: Container(
                  width: 30.w,
                  height: 15.w,
                  decoration: BoxDecoration(
                      color: Color(0xFFE1F4EE),
                      borderRadius: BorderRadius.only(
                        topLeft: Radius.circular(8.w),
                        topRight: Radius.circular(18.w),
                        bottomLeft: Radius.zero,
                        bottomRight: Radius.circular(8.w),
                      )),
                  alignment: Alignment.center,
                  child: Text(
                    '2次',
                    textAlign: TextAlign.center,
                    style: TextStyle(color: Color(0xFF009669), fontSize: 10.sp),
                  ),
                ),
              ),
            ],
          ),
          Offstage(
            offstage: widget.type == 0,
            child: Container(
                margin: EdgeInsets.only(top: 8.w),
                child: Row(
                  children: [
                    Image.asset(
                      'assets/images/ic_alert_tip.png',
                      width: 16.w,
                      height: 16.w,
                    ),
                    Expanded(
                      child: Text(
                        '该客户额度存续止期即将到期，请尽快联系客户支用或重新授信。',
                        style: TextStyle(
                            color: Color(0xFFFF3B30), fontSize: 10.sp),
                      ),
                    ),
                  ],
                )),
          )
        ],
      ),
    );
  }
}
